// 导入拦截器模块
import request from '@/utils/request'

// 封装暴露获取组织架构请求接口
export const getDepartmentsAPI = () => {
  return request.get('/company/department')
}

// 封装并暴露新增部门请求接口
export const addDepartmentAPI = (data) => {
  return request.post('/company/department', data)
}

/** *
 * 获取部门详情
 * ***/
export const getDepartDetailAPI = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 编辑部门
 *
 * ***/
export function updateDepartmentsAPI(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/** *
 *  根据id根据部门  接口是根据restful的规则设计的   删除 delete  新增 post  修改put 获取 get
 * **/
export function delDepartmentsAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
